import Base from 'models/base';

export default class ActivityTypeForm extends Base {
  activityTypeName = '';
  status = 1;

  constructor(activity) {
    super();

    if (activity === undefined) {
      return;
    }

    this.activityTypeName = activity.activityTypeName;
    this.id = activity.activityTypeId;

    let status = activity.status;
    this.status = Number(status);
  }

  checkValid() {
    let fields = ['activityTypeName'];
    return this.checkRequired(fields);
  }

  getObject() {
    let postData = {
      activityTypeName: this.activityTypeName,
      status: this.status
    };

    let id = this.id;
    if (id !== undefined) {
      postData.activityTypeId = id;
    }
    return postData;
  }
}
